#!/usr/bin/env python

"""
 \file VisionManipulation_idl_examplefile.py
 \brief Python example implementations generated from VisionManipulation.idl
 \date $Date$


"""

import CORBA, PortableServer
import _GlobalIDL, _GlobalIDL__POA


class SchedulerService_i (_GlobalIDL__POA.SchedulerService):
    """
    \class SchedulerService_i
    Example class implementing IDL interface SchedulerService
    """

    def __init__(self):
        """
        \brief standard constructor
        Initialise member variables here
        """
        self.busy = False
        self.recognition_service = None
        pass

    # long getModelID()
    def getModelID(self):
        raise CORBA.NO_IMPLEMENT(0, CORBA.COMPLETED_NO)
        # *** Implement me
        # Must return: result

    # void setModelID(in long ModelID)
    def setModelID(self, ModelID):
        print "Busy? :", self.busy
        print "setModelID: %s" % ModelID
        try:
            if self.busy == False and self.recognition_service._ptr():
                self.busy = True
                self.recognition_service._ptr().setModelID(ModelID)

        except :
            print "Something is wrong."
            raise  

class RecognitionService_i (_GlobalIDL__POA.RecognitionService):
    """
    \class RecognitionService_i
    Example class implementing IDL interface RecognitionService
    """

    def __init__(self):
        """
        \brief standard constructor
        Initialise member variables here
        """
        pass

    # long getValue()
    def getValue(self):
        raise CORBA.NO_IMPLEMENT(0, CORBA.COMPLETED_NO)
        # *** Implement me
        # Must return: result

    # void setValue(in long ModelID)
    def setValue(self, ModelID):
        raise CORBA.NO_IMPLEMENT(0, CORBA.COMPLETED_NO)
        # *** Implement me
        # Must return: None

    # long getModelID()
    def getModelID(self):
        raise CORBA.NO_IMPLEMENT(0, CORBA.COMPLETED_NO)
        # *** Implement me
        # Must return: result

    # void setModelID(in long ModelID)
    def setModelID(self, ModelID):
        raise CORBA.NO_IMPLEMENT(0, CORBA.COMPLETED_NO)
        # *** Implement me
        # Must return: None



class RecognitionServiceSDL_i (_GlobalIDL__POA.RecognitionServiceSDL):
    """
    \class RecognitionServiceSDL_i
    Example class implementing IDL interface RecognitionServiceSDL
    """

    def __init__(self):
        """
        \brief standard constructor
        Initialise member variables here
        """
        pass

    # void recognize_by_ID(in long ModelID, out RTC::TimedDoubleSeq Result)
    def recognize_by_ID(self, ModelID):
        raise CORBA.NO_IMPLEMENT(0, CORBA.COMPLETED_NO)
        # *** Implement me
        # Must return: Result



class GraspPlanStart_i (_GlobalIDL__POA.GraspPlanStart):
    """
    \class GraspPlanStart_i
    Example class implementing IDL interface GraspPlanStart
    """

    def __init__(self):
        """
        \brief standard constructor
        Initialise member variables here
        """
        pass

    # void GraspPlanningStart(in unsigned long ObjId, in GraspPlanStart::DblSequence3 objPos, in GraspPlanStart::DblSequence9 objOri, out unsigned long state)
    def GraspPlanningStart(self, ObjId, objPos, objOri):
        raise CORBA.NO_IMPLEMENT(0, CORBA.COMPLETED_NO)
        # *** Implement me
        # Must return: state

    # void ReleasePlanningStart(in unsigned long ObjId, in GraspPlanStart::DblSequence3 objPos, in GraspPlanStart::DblSequence9 objOri, out unsigned long state)
    def ReleasePlanningStart(self, ObjId, objPos, objOri):
        raise CORBA.NO_IMPLEMENT(0, CORBA.COMPLETED_NO)
        # *** Implement me
        # Must return: state

    # void PickAndPlacePlanningStart(in unsigned long ObjId, in GraspPlanStart::DblSequence3 objPos, in GraspPlanStart::DblSequence9 objOri, out unsigned long state)
    def PickAndPlacePlanningStart(self, ObjId, objPos, objOri):
        raise CORBA.NO_IMPLEMENT(0, CORBA.COMPLETED_NO)
        # *** Implement me
        # Must return: state


if __name__ == "__main__":
    
    # Initialise the ORB
    orb = CORBA.ORB_init(sys.argv)
    
    # As an example, we activate an object in the Root POA
    poa = orb.resolve_initial_references("RootPOA")

    # Create an instance of a servant class
    servant = SchedulerService_i()

    # Activate it in the Root POA
    poa.activate_object(servant)

    # Get the object reference to the object
    objref = servant._this()
    
    # Print a stringified IOR for it
    print orb.object_to_string(objref)

    # Activate the Root POA's manager
    poa._get_the_POAManager().activate()

    # Run the ORB, blocking this thread
    orb.run()

